<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>后盾人</title>
  </head>
  <body></body>
  <script>
    function extend(sub, sup) {
      sub.prototype = Object.create(sup.prototype);
      Object.defineProperty(sub.prototype, "constructor", {
        value: sub,
        enumerable: false
      });
    }
    function Address() {}
    Address.prototype.getAddress = function() {
      console.log("获取收货地址");
    };
    function Credit() {}
    Credit.prototype.total = function() {
      console.log("积分统计");
    };
    function Request() {}
    extend(Request, Credit);
    Request.prototype.ajax = function() {
      console.log("请求后台");
    };
    function User(name, age) {
      this.name = name;
      this.age = age;
    }
    extend(User, Request);
    User.prototype.show = function() {
      console.log(this.name, this.age);
    };

    function Admin(name, age) {
      User.call(this, name, age);
    }
    extend(Admin, User);
    let admin = new Admin("向军", 19);
    admin.show();
    admin.ajax();
    admin.total();

    function Member(name, age) {
      User.call(this, name, age);
    }
    extend(Member, User);
    let lisi = new Member("李四", 22);
  </script>
</html>
